package jsyf.oa.web.system;

import com.alibaba.fastjson.JSONObject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.system.ShouldSignHolidayFacade;

/**
 * Created by Administrator on 2018/4/9 0009.
 */
@Api(value = "新出勤天数配置接口", description = "新出勤天数配置接口")
@Controller
@RequestMapping("/shouldHoliday")
public class ShouldSignHolidayController {
    @Resource
    private ShouldSignHolidayFacade shouldSignHolidayFacade;


    @RequestMapping(value = "/config.json", method = RequestMethod.POST)
    public void config(HttpServletResponse response, @RequestBody String jsonData) {
        Boolean result = shouldSignHolidayFacade.config(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(String.valueOf(result)));
    }

    @RequestMapping(value = "/getShouldSignInList.json", method = RequestMethod.POST)
    public void getShouldSignInList(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> list = shouldSignHolidayFacade.getShouldSignInList(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(list));
    }

    @RequestMapping(value = "/getShouldSignMonthList.json", method = RequestMethod.POST)
    public void getShouldSignMonthList(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> list = shouldSignHolidayFacade.getShouldSignMonthList(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(list));
    }
}
